package com.restful.controller;

import com.restful.entity.UserInfo;
import com.restful.vo.ResultVo;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class RestfulController {
    @PostMapping
    public ResultVo addUser(@RequestBody UserInfo userInfo){
        System.out.println(userInfo);
        return new ResultVo(200,"新增成功",null);
    }

    @DeleteMapping("/{id}")
    public String del(@PathVariable Integer id){
        System.out.println("del 用户id: "+id);
        return "删除成功";
    }

    @PutMapping
    public String edit(@RequestBody UserInfo userInfo){
        System.out.println("修改成功");
        return "修改成功";
    }

    @GetMapping("/{id}")
    public String getById(@PathVariable Integer id){
        System.out.println("查询单个"+id);
        return "查询单个";
    }

    @GetMapping
    public String getUsers(){
        System.out.println("查询所有的用户");
        return "查询所有的用户";
    }
}
